// ignore_for_file: file_names
import 'package:flutter/material.dart';
import 'package:flutterdemo/common/theme.dart';
import '/components/button.dart';
class Login extends StatefulWidget {
  Login({Key? key}) : super(key: key);

  @override
  _LoginState createState() => _LoginState();
}

class _LoginState extends State<Login> {
  String? username;
  String? password;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        toolbarHeight: 0,
      ),
      body: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
              image: NetworkImage(
                  myTheme.theme.imgUrl,
              ),
              fit: BoxFit.cover
          ),
        ),
        child: Center(
          child: Container(
            width: 300,
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              color:Color.fromRGBO(255, 255, 255, 0.6),
              borderRadius:BorderRadius.all(Radius.circular(4.0))
            ),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                TextField(
                  onChanged: (e){
                    username = e;
                  },
                  decoration: InputDecoration(
                    prefixIcon: Icon(Icons.usb_rounded),
                    hintText:"请输入账号",
                  ),
                ),
                TextField(
                  onChanged: (v){
                    password = v;
                  },
                  decoration: InputDecoration(
                    prefixIcon: Icon(Icons.settings),
                    hintText:"请输入密码"
                  ),
                ),
                SizedBox(height: 20,),
                MyButton("登录",width:double.infinity,onPressed: (){
                  Navigator.pushNamedAndRemoveUntil(context, "/", (route) => false);
                },),
                SizedBox(height: 5,),
                InkWell(
                  onTap: (){
                    Navigator.pushNamed(context, 'reg');
                  },
                  child: Text("没有账号？ 点击立即注册",style: TextStyle(color: Colors.blue),),
                ),
                SizedBox(height: 5,),

            ],),
          )
        ),
      ),
    );
  }
}
